function ajaxEX(obj) {
    let {
        url,
        data = {},
        success,
        fault,
        type = "get",
        colName,
        timeout = 200,
    } = obj;

    let str = "";
    for (var i in data) {
        str += `${i}=${data[i]}&`;
    }

    url = type === "post" ? url : url + "?" + str + "__zjct=" + Date.now();

    if (type === "jsonp") {
        var script = document.createElement("script");
        document.body.appendChild(script);
        script.src = url;
        window[data[colName]] = function (res) {
            success && success(res);
            script.remove();
            fault = null;
        };
    } else {
        //开启ajax
        let ajax = new XMLHttpRequest();
        ajax.open(type, url, true);
        ajax.onload = function () {
            if (ajax.status === 200) {
                success && success(ajax.responseText);
                fault = null;
            } else {
                fault && fault("Error Code:" + ajax.status);
                fault = null;
            }
        };

        if (type === "post") {
            ajax.setRequestHeader(
                "Content-Type",
                "application/x-www-form-urlencoded"
            );
            ajax.send(str.slice(0, str.length - 1));
        } else if (type === "get") {
            ajax.send();
        }
    }

    setTimeout(() => {
        fault && fault("timeout");
        success = null;
        fault = null;
    }, timeout);
}